/*
 * MainServiceTemplement.java Created on 2006-12-11
 * Copyright(c) 2006-2008 by vnv
 * ALL Rights Reserved.
 */
package cn.agiledata.bank.webService;

import cn.agiledata.bank.webService.formbean.IVRRequest;
import cn.agiledata.bank.webService.formbean.IVRResponse;


/**
 * The mainservice method templement
 * @time: 2006-12-11
 * @author  maxianbo
 */
public abstract class AbstractMainServiceTemplement {
    /**
     * The MainService method call back
     * @param callbank
     * @param request
     * @return
     */
    public abstract IVRResponse doMainService(IMainServiceCallBack callbank,
        IVRRequest request);

    ///////////////////// some help method  ///////////////////////////////
    /**
     * check the payment passwd.
     * @param request
     * @return check result  false -- no find user true -- find user.
     */
    protected boolean checkUserPaymentpasswd(IVRRequest request,
        IVRResponse response) {
        /** check the request whether it is null */
        if (!WebServiceUtil.checkUser(request, response,"")) {
            return false;
        }

        //check the payment
        return true;
    }

    /**
     * Get the IVR service bean instance.
     * @param beanName the serive bean name.
     * @return the serive bean instance.
     */
    protected Object getBean(String beanName) {
        Object obj = IVRServiceBeanFactory.getIVRServiceBeanInstrance(beanName);

        return obj;
    }
}
